/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */
package l1j.server.server.serverpackets;

import java.util.logging.Logger;

import l1j.server.server.Opcodes;

/**
 * S_107 スキルアイコンや遮断リストの表示など複数の用途に使われる
 */
public class S_PacketBox extends ServerBasePacket {
	private static final String _S__1F_S_PacketBox = "[S] S_PacketBox";

	private static Logger _log = Logger.getLogger(S_PacketBox.class.getName());

	private byte[] _byte = null;

	// *** S_107 sub code list ***
	//public static final int ADD_EXCLUDE2 = 17; // 複数登録。使われていない？
	public static final int ADD_EXCLUDE = 18;
	public static final int REM_EXCLUDE = 19;
	public static final int SKILLS1 = 20;
	public static final int SKILLS2 = 21;
	public static final int SKILL_AURA = 22;
	public static final int SKILL_BLUEPOTION = 34;
	public static final int SKILL_POLYMORPH = 35;
	public static final int SKILL_CHATBAN = 36;
	public static final int RELOGIN = 42;
	public static final int CALL_SOMETHING = 45; // [CALL] ボタンのついたウィンドウが表示される

	// 18 Add Exclude, 19 Remove Exclude
	public S_PacketBox(int subCode, String name) {
		buildPacket(subCode, name);
	}

	private void buildPacket(int subCode, String name) {
		writeC(Opcodes.S_OPCODE_PACKETBOX);
		writeC(subCode);
		writeS(name);
	}

	// 17 Add Exclude (multiple)
//	public S_PacketBox(int subCode, Object[] names) {
//		buildPacket(subCode, names);
//	}
//
//	private void buildPacket(int subCode, Object[] names) {
//		writeC(Opcodes.S_OPCODE_PACKETBOX);
//		writeC(subCode);
//		writeC(names.length);
//		for (Object name : names) {
//			writeS((String) name.toString());
//		}
//	}

	@Override
	public byte[] getContent() {
		if (_byte == null) {
			_byte = getBytes();
		}

		return _byte;
	}

	public String getType() {
		return _S__1F_S_PacketBox;
	}
}